<?php
require_once('configuration.php');

/*
//MANDATORY PARAMS

    FILE

//OPTIONAL PARAMS
  
  SENSOR_ID
  TIMESTAMP
  DURATION
  PROTOCOL
  ENCODING
*/
//phpinfo();
//print_r($_POST);echo '<hr>';

if ($_FILES["file"]["error"] > 0) {
// See http://www.php.net/manual/en/features.file-upload.errors.php 
  show_error($_FILES["file"]["error"], "filename= " . $_FILES["file"]["name"]);
} else {
  $targetFile = $UPLOAD_FOLDER . "/" . $_FILES["file"]["name"];
  $isOK = move_uploaded_file($_FILES["file"]["tmp_name"], $targetFile);
  if ($isOK) {
    echo "OK";
  } else{
    $info = "Upload:" . $_FILES["file"]["name"] ." Type:". $_FILES["file"]["type"] . " Size: " . ($_FILES["file"]["size"] / 1024) . "Kb Temp file: " . $_FILES["file"]["tmp_name"];
    show_error("move_uploaded_file", $info);
  }
}
  
function show_error($code, $information){
  echo "ERROR: code=$code information=$information";  
}  

?>
